<template>
  <div>
    <nav-bar class="cart-nav-bar">
      <span slot="center">购物车({{cartLength}})</span>
    </nav-bar>
    <scroll class="content" ref="scroll">
     <cart-list :cart='cartList'/>
    </scroll>
    <cart-bottom-bar :count="cartLength" :items="cartList"/>
  </div>

</template>

<script>
  import {mapGetters} from 'vuex'
  import NavBar from "components/common/navbar/NavBar";
  import CartList from "./childCompos/CartList";
  import CartBottomBar from "./childCompos/CartBottomBar";
  import Scroll from "components/common/scroll/Scroll";

  export default {
    name: "Cart",
    components:{
      NavBar,
      CartList,
      CartBottomBar,
      Scroll
    },
    computed:{
      ...mapGetters(['cartLength','cartList'])
    },
    activated() {
      this.$refs.scroll.refresh()
    }
  }
</script>

<style scoped>
  .content{
    overflow: hidden;
    position: absolute;
    top: 50px;
    bottom: 100px;
    left: 0;
    right: 0;
  }
  .cart-nav-bar{
    background-color: var(--color-tint);
    color: #fff;
    font-size: 20px;
    height: 50px;
    line-height: 50px;
  }
</style>